<?php

namespace app\common\model;

class AiOrder extends BaseModel
{
    protected $append = ['image_count'];
    protected $dateFormat = "Y-m-d H:i:s";
    protected $type = [
        "success_time" => "timestamp",
    ];

    public function image()
    {
        return $this->hasMany(AiImage::class,'order_id');
    }

    public function getImageCountAttr()
    {
        return $this->image()->count();
    }
}